<script>

  // function Person(name) {
  //   this.name = name

  // }

  // Person.prototype.run = function () {
  //   console.log("我在奔跑")
  // }

  // let p = new Person("张三")
  // p.run()

  // let p = Object.create(Person.prototype)
  // // console.log(p)
  // p.run()


  //构造函数 Animal
  function Animal(weight) {
    this.weight = weight
  }
  Animal.prototype.run = function () {
    console.log("我在奔跑")
  }

  //构造函数 Dog
  function Dog(weight) {
    Animal.call(this, weight)
  }

  Dog.prototype = Object.create(Animal.prototype)
  Dog.prototype.constructor = Dog

  Dog.prototype.bark = function () {
    console.log("汪汪叫")
  }

  let d = new Dog(100)
  console.log(d.weight)
  d.run()
  d.bark()





  // let a = new Animal(100)
  // console.log(a.weight)
  // a.run()








</script>